package ronglei.day01.demo06ArrayList;
/*
* 返回偶素集合
*
* */
import java.util.ArrayList;
import java.util.Random;

public class ArrayListRetuan {
    public static void main(String[] args) {
        Random num = new Random();
        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 0; i < 20; i++) {
            list.add(num.nextInt(10)+1);
        }
        System.out.println(list);
        System.out.println(ListReturn(list));
    }
    public  static ArrayList<Integer>  ListReturn(ArrayList<Integer> list){
        ArrayList<Integer> integers = new ArrayList<>();
        for (int i = 0; i < list.size(); i++) {
            if(list.get(i)%2==0){
                integers.add(list.get(i));
            }
        }
        return integers;
    }

}
